      SUBROUTINE OUTPT_OT(FI,DFI,RCONT,RCEX,RESID,I_ELET,
     &                  IDCASO,IC,NEPE,NCasos,FDEX,FROT)


      IMPLICIT DOUBLE PRECISION (A-H,O-Z)

      INCLUDE 'param_dim.inc'

      DIMENSION FI(NX),DFI(NX)
      DIMENSION RCONT(NRCX),RCEX(NRCX)
	  real*8 c

      INTEGER IDCASO(NCasosX,3),I_ELET(16,NELEX)
      INTEGER FDEX,FROT
      real resid

      IELET1= IDCASO(IC,1)
      IELET2= IDCASO(IC,2)
      IELET3= IDCASO(IC,3)

      IR0= (IC-1)*(16-3)

      IRES= 0

      DO IE= 1,16
         IF( (IE.NE.IELET1).AND.
     &       (IE.NE.IELET3).AND.   
     &       (IE.NE.IELET2) ) THEN
            IRES= IRES + 1
            INOF= I_ELET(IE,1+NEPE/2)
	    RCONT(IR0+IRES)= FI(INOF)
         ENDIF
      ENDDO


      IF(IC.EQ.NCASOS) THEN

         NRC= NCASOS*(16-3)


         RESID= 0.D0
         DO I=1,NRC
            RESID= RESID + (RCONT(I)-RCEX(I))*(RCONT(I)-RCEX(I))
         ENDDO
         RESID= 0.5 * RESID

         WRITE(FROT,1010) (RCEX(I),I=1,NRC)

         WRITE(FROT,1010) ((RCONT(I)),I=1,NRC)
 1010    FORMAT(8(13E12.4,/))

         WRITE(FROT,1020) RESID
 1020    FORMAT(5X,'RESIDUO :',E15.5,
     &      'medidas em rel. ao eletr. de referencia')
      
      ENDIF


     
      RETURN
      END
